package Adapter;

public class Main {
    public static void main(String[] args){
        AudioPlayer player = new AudioPlayer();
        play(player,"稻香.mp3");
        play(player,"复仇者联盟5.mp4");
        play(player,"哈哈哈.vlc");
        play(player,"error.mp5");
    }

    public static void play(AudioPlayer player,String fileName){
        int index = fileName.lastIndexOf(".");
        String name = fileName.substring(0,index);
        String type = fileName.substring(index+1,fileName.length());
        player.play(type,name);
    }
}
